package shuati.chuanzhibei.juesai;

import java.io.*;
import java.util.Scanner;

/**
 * @Date : 2023-04-09
 * @Description:
 */
public class AAAAAA {
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        if(a.substring(a.indexOf(".")).equals(b.substring(b.indexOf(".")))) System.out.println("YES");
        else System.out.println("NO");
    }
}
